from fastapi import APIRouter, Depends
from ..model import Power
from sqlalchemy.ext.asyncio import AsyncSession
from extensions.db.mysql import get_async_session
power_router = APIRouter()


@power_router.post("/test")
async def tset_power(session: AsyncSession = Depends(get_async_session)):
    async with session.begin():
        session.add_all(
            [
                Power(name="power1"),
                Power(name="power2"),
                Power(name="power3"),
            ]

        )
    await session.commit()
    return {"msg": "ok"}
